import axios from 'axios'
import apiUrls from 'common/api-urls'
// import { contentTypeWww } from 'common/axio-decorate'
export function exportFile(data) {
  const url = window.URL.createObjectURL(new Blob([data]));
  const link = document.createElement('a');
  link.setAttribute('href', url)
  link.setAttribute('download', 'filename.xlsx'); // 设置下载文件名
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
  window.URL.revokeObjectURL(url); // 清理内存
}

export function getLessonUserExercise(data) {
  return axios.get(apiUrls.getLessonUserExercise, {
    params: data
  })
}

export function exportRecord(params) {
  return axios.get(`${apiUrls.exportLessonUserExercise}`, {
    params: params
  })
}

export function getStatCourseStudy(data) {
  return axios.get(apiUrls.getStatCourseStudy, {
    params: data
  })
}

export function getFlushStatCourseStudy(data) {
  return axios.get(apiUrls.getFlushStatCourseStudy, {
    params: data
  })
}

export function getStatCourseTrainee(data) {
  return axios.get(apiUrls.getStatCourseTrainee, {
    params: data
  })
}

export function getFlushStatCourseTrainee(data) {
  return axios.get(apiUrls.getFlushStatCourseTrainee, {
    params: data
  })
}

export function getStatCourseGroup(data) {
  return axios.get(apiUrls.getStatCourseGroup, {
    params: data
  })
}

export function getFlushStatCourseGroup(data) {
  return axios.get(apiUrls.getFlushStatCourseGroup, {
    params: data
  })
}

export function getStatLessonTrainee(data) {
  return axios.get(apiUrls.getStatLessonTrainee, {
    params: data
  })
}

export function getFlushStatLessonTrainee(data) {
  return axios.get(apiUrls.getFlushStatLessonTrainee, {
    params: data
  })
}

export function getStatLessonGroup(data) {
  return axios.get(apiUrls.getStatLessonGroup, {
    params: data
  })
}

export function getFlushStatLessonGroup(data) {
  return axios.get(apiUrls.getFlushStatLessonGroup, {
    params: data
  })
}

export function getExerciseReport(data) {
  return axios.get(`${apiUrls.getExerciseReport}/${data.exerciseId}`, {
    params: data
  })
}
